package ldh.im.admin.config;

import ldh.common.spring.security.cryptogram.AesUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Configuration
@Component
public class AesService {

    @Value("${im.aesKey}")
    private String aesKey;

    public String encrypt(String msg) throws Exception {
        return AesUtil.encrypt(msg, aesKey);
    }

    public String decrypt(String encodeMsg) throws Exception {
        return AesUtil.decrypt(encodeMsg, aesKey);
    }
}
